<?php

namespace app\common\validate\wechat;

class EasyWchatResult extends Base
{
	/**
     * 验证规则
     */
    protected $rule = [
        'return_code'         => 'require|communication_status',
        'result_code'         => 'require|business_processing'
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'return_code.require'        => '通讯状态返回结果异常',
        'result_code.require'        => '业务处理返回结果异常'
    ];

    //通讯状态验证
	public function communication_status($value, $rule, $result) {
		if($value !== 'SUCCESS') {
			return $result['return_msg'];
		}
		return true;
	}

	//业务处理结果验证
	public function business_processing($value, $rule, $result) {
		if($value !== 'SUCCESS') {
			return $result['err_code_des'];
		}
		return true;
	}


}
